<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //一千以内的水仙花数
        function sxh() {
            for (var i = 100; i <= 999; i++) {
                // 拆分这个三位数
                var g = i % 10
                var s = parseInt(i / 10) % 10
                var b = parseInt(i / 100)
                if (g ** 3 + s ** 3 + b ** 3 == i) {
                    console.log(i)
                }
            }
        }
        sxh()
    </script>

</body>

</html>